package com.xinlan.imageeditlibrary.editimage.utils;

import android.app.Activity;
import android.app.AlertDialog;
import android.view.Gravity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;

import com.xinlan.imageeditlibrary.R;

/**
 * @author 关忆北丶
 * @description:
 * @date :2020/9/13 14:18
 */
public class DiaLogUtils {

    /**
     * 删除图片
     *
     * @param act
     * @return
     */
    public static AlertDialog showDialog(Activity act, View view ) {
        final AlertDialog dialog = new AlertDialog.Builder(act, AlertDialog.THEME_HOLO_DARK).create();
        dialog.setCancelable(true);
        dialog.show();
        Window window = dialog.getWindow();
        window.clearFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
        WindowManager.LayoutParams lp = window.getAttributes();
        lp.width =DensityUtil.dip2px(act,280);
        lp.height = DensityUtil.dip2px(act,140);
        window.getDecorView().setBackgroundColor(act.getResources().getColor(R.color.transparent));
        window.setAttributes(lp);
        window.setContentView(view);
        window.setGravity(Gravity.CENTER);
        return dialog;
    }


}
